<?php 

require_once('getconfig.php');

Class Model_MatriCity extends Dbo_DbManager
 {

	protected $C_DISTRICT;
	protected $C_CITY;
	

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getDistrict()
	{
		return  $this->C_DISTRICT;
	}
	public function setDistrict($C_DISTRICT)
	{
		$this->C_DISTRICT=$C_DISTRICT;
	}
	public function getCity()
	{
		return  $this->C_CITY;
	}
	public function setCity($C_CITY)
	{
		$this->C_CITY=$C_CITY;
	}

	public function write($param = false)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_cast)
	{
		$objModel_dist = new Model_MatriCity(FALSE);
		@$objModel_dist->setDistrict($arrModel_cast['C_DISTRICT']);
		@$objModel_dist->setCity($arrModel_cast['C_CITY']);

		return $objModel_dist;
 	 } 	 
    
     public static function get_city($dist){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from matricity where C_DISTRICT='$dist'";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
    

 }
 ?>